const fs = require("fs");
const path = require("path");

let filePath = path.join(__dirname , "new.txt");
let toPath = path.join(__dirname , "to.txt");


let readStream = fs.createReadStream(filePath);
let writeStream = fs.createWriteStream(toPath);

readStream.pipe(writeStream);

let fileObj = fs.statSync(filePath);

/*
    传入文件的权限 ， fs.chmodSync(path , mode)
*/ 

fs.chmodSync(toPath , fileObj.mode);
console.log(fileObj.mode)